<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="824.41">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica; min-height: 22.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000; min-height: 12.0px}
p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000}
span.s1 {color: #0000bf}
span.s2 {color: #007300}
span.Apple-tab-span {white-space:pre}
</style>
</head>
<body>
<p class="p1">//SLUGens released under the GNU GPL as extensions for SuperCollider 3, by Nick Collins, http://www.informatics.sussex.ac.uk/users/nc81/</p>
<p class="p2"><b></b><br></p>
<p class="p3"><b>TermanWang<span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>Neural Oscillator</b></p>
<p class="p2"><b></b><br></p>
<p class="p4"><b>TermanWang.ar(input,reset, ratex,ratey, alpha, beta, eta, initx,inity, mul, add)</b></p>
<p class="p5"><br></p>
<p class="p4">NOTE: experimental, not working well</p>
<p class="p5"><br></p>
<p class="p4">Naive Euler ODE solver implementation of a neural oscillator model by Terman and Wang (see Brown, G.J., and Wang, D. 2006. "Neural and Perceptual Modeling." In Wang, D., and Brown, G. J., eds. <i>Computational Auditory Scene Analysis: Principles, Algorithms, and Applications</i>. Hoboken, NJ: John Wiley and Sons/IEEE Press, p.355).<span class="Apple-converted-space"> </span></p>
<p class="p5"><br></p>
<p class="p4">Dx = ratex *<span class="Apple-converted-space">  </span>(<span class="Apple-converted-space">  </span>3*x - x^3 (+ 2) - y + input )<span class="Apple-converted-space"> </span></p>
<p class="p5"><br></p>
<p class="p4">Dy = ratey *<span class="Apple-converted-space">  </span>(eta ( alpha* (1 + tanh(x/beta)) - y ))</p>
<p class="p5"><br></p>
<p class="p4">All parameters can have .kr rate UGens plugged in. The +2 is left out and can be added back in as part of the input. eta can also be left out as part of yrate.<span class="Apple-converted-space"> </span></p>
<p class="p5"><br></p>
<p class="p4"><b>input</b>- audio rate input</p>
<p class="p4"><b>reset</b>- restart</p>
<p class="p4"><b>ratex</b>- update rate for x</p>
<p class="p4"><b>ratey</b>- update rate for y<span class="Apple-converted-space"> </span></p>
<p class="p4"><b>alpha, beta, eta</b>- Equation parameters</p>
<p class="p4"><b>initx</b>- reset value for u</p>
<p class="p4"><b>inity</b>- reset value for w</p>
<p class="p5"><br></p>
<p class="p6"><br></p>
<p class="p1">//difficult to find active parameters, forced to try resetting!<span class="Apple-converted-space"> </span></p>
<p class="p7"><br></p>
<p class="p8">{<span class="s1">Out</span>.ar(0,<span class="s1">Pan2</span>.ar(0.5*<span class="s1">TermanWang</span>.ar(2.0,<span class="s1">Impulse</span>.kr(<span class="s1">MouseX</span>.kr(1,1000)),0.1,0.01,1.0,1.0,1.0,<span class="s1">MouseX</span>.kr(0.4,1.2), <span class="s1">MouseY</span>.kr(2.0,4.0)),0.0))}.play;</p>
<p class="p7"><br></p>
<p class="p7"><br></p>
<p class="p8">{<span class="s1">Out</span>.ar(0,<span class="s1">Pan2</span>.ar(0.5*<span class="s1">TermanWang</span>.ar(<span class="s1">LFNoise1</span>.ar(<span class="s1">LFNoise0</span>.kr(0.5,500,500),1.0,3.0),<span class="s1">Impulse</span>.kr(<span class="s1">MouseX</span>.kr(1,10000, <span class="s2">'exponential'</span>)),0.01,0.01,1.0,1.0,1.0,<span class="s1">MouseX</span>.kr(0.4,1.2), <span class="s1">MouseY</span>.kr(2.0,4.0)),0.0))}.play;</p>
<p class="p7"><br></p>
<p class="p7"><br></p>
<p class="p8">{<span class="s1">Out</span>.ar(0,<span class="s1">Pan2</span>.ar(<span class="s1">FreeVerb</span>.ar(0.5*<span class="s1">TermanWang</span>.ar(2.0+ <span class="s1">SinOsc</span>.ar(<span class="s1">MouseX</span>.kr(10,10000,<span class="s2">'exponential'</span>),0,<span class="s1">MouseY</span>.kr(0.1,100.0,<span class="s2">'exponential'</span>)),<span class="s1">Impulse</span>.kr(<span class="s1">MouseX</span>.kr(1,10000, <span class="s2">'exponential'</span>)),0.01,0.01,1.0,1.0,1.0,<span class="s1">MouseX</span>.kr(0.4,1.2), <span class="s1">MouseY</span>.kr(2.0,4.0)),0.5)))}.play;</p>
</body>
</html>
